package cn.cinz.util;

import redis.clients.jedis.Jedis;

/**
* redis工具类
* @Author: zengcheng
* @Description: (内容作用)
* @Date: 2021/8/23 23:26
*
*/
public class RedisUtil {

    private static Jedis jedis = null;
    private static final String HOST = "127.0.0.1";//redis 连接地址

    /**
     * 单例模式 创建 jedis对象，并获得连接
     * @return jedis
     */
    public static Jedis getRedis(){

        jedis = new Jedis(HOST,6379);

        return jedis;
    }


    /**
     * redis回收
     */
    public static void releaseRedis(){

        if (jedis != null){
            jedis = null;
            jedis.close();
        }

    }


}
